package jk.spider.util.config;

import jk.spider.util.config.properties.PropertiesConfiguration;

public class ConfigurationFactory {

    public static final String CONFIG_DEFAULT = "default";

    protected static SpiderConfiguration instance;

    public static synchronized SpiderConfiguration getConfiguration (String site, String path ) {
        if ( instance == null ) {
            instance = new PropertiesConfiguration (site, path );
        }
        return instance;
    }

    public static synchronized SpiderConfiguration getConfiguration ( String site, String file, String path ) {

        if ( instance == null ) {
          instance = new PropertiesConfiguration ( site, file, path );
        }
        return instance;
    }
    
    public static synchronized SpiderConfiguration getConfiguration ( String site, String file, String type, String path ) {

        if ( instance == null ) {
          instance = new PropertiesConfiguration ( site, file, type, path );
        }
        return instance;
    }

    public static synchronized SpiderConfiguration setConfiguration ( SpiderConfiguration configuration ) {
        instance = configuration;
        return instance;
    }

    public static synchronized void cleanConfiguration ( ) {
        instance = null;
    }

}
